import request from "@/utils/request";

export function getTags(paramters) {
  return request({
    url: "api/v1/tags",
    method: "get",
    params: paramters,
    authServer: false,
  });
}

export function getAllTags() {
  return request({
    url: "api/v1/tags/all",
    method: "get",
    authServer: false,
  });
}

export function getTag(id) {
  return request({
    url: "api/v1/tags/" + id,
    method: "get",
    authServer: false,
  });
}

export function addTag(data) {
  return request({
    url: "api/v1/tags",
    method: "post",
    data: data,
    authServer: false,
  });
}

export function updateTag(data) {
  return request({
    url: "api/v1/tags",
    method: "put",
    data: data,
    authServer: false,
  });
}

export function deleteTag(id) {
  return request({
    url: "api/v1/tags/" + id,
    method: "delete",
    authServer: false,
  });
}

export function getTagItems(id, params) {
  return request({
    url: "api/v1/tags/" + id + "/items",
    method: "get",
    authServer: false,
    params: params,
  });
}

export function deleteTagItem(id, itemId) {
  return request({
    url: "api/v1/tags/" + id + "/items/" + itemId,
    method: "delete",
    authServer: false,
  });
}
